package com.gexin.common.job;

import com.gexin.core.web.AppController;
import com.gexin.model.activity.MemberInfo;
import com.gexin.service.integral.QuartzManager;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.log.Log;

import java.util.List;

/**
 * 演示定时器
 * @author Administrator
 */
@ControllerBind(controllerKey = "/1234567")
public class TestJob2 implements  Runnable{
	public static String JOB_NAME = "动态任务调度";
	public static String TRIGGER_NAME = "动态任务触发器";
	public static String JOB_GROUP_NAME = "XLXXCC_JOB_GROUP";
	public static String TRIGGER_GROUP_NAME = "XLXXCC_JOB_GROUP";
	static Log log = Log.getLog(ActivityJob.class);

	public  void run() {
		try {
		/*	System.out.println("【系统启动】开始(每1秒输出一次)...");
			QuartzManager.addJob(JOB_NAME, JOB_GROUP_NAME, TRIGGER_NAME, TRIGGER_GROUP_NAME, MyJob.class, "0/1 * * * * ?");
*/
//
//			System.out.println(memberInfos.get(1));
			//Thread.sleep(5000);
			//System.out.println("【修改时间】开始(每5秒输出一次)...");//0 0 0 31 12 ?
			//List<MemberInfo> memberInfos = MemberInfo.dao.find("select * from t_member_info");
			//QuartzManager.modifyJobTime(JOB_NAME, JOB_GROUP_NAME, TRIGGER_NAME, TRIGGER_GROUP_NAME, "*/10 * * * * ?");
			//memberInfos.forEach(memberInfo -> {
//				memberInfo.setIntegral(4);
			/*	memberInfo.update();
			});
			if(memberInfos!=null){
				log.info("12312312312312");
			}*/
			/*Thread.sleep(6000);
			System.out.println("【移除定时】开始...");
			QuartzManager.removeJob(JOB_NAME, JOB_GROUP_NAME, TRIGGER_NAME, TRIGGER_GROUP_NAME);
			System.out.println("【移除定时】成功");*/
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
